<template>
    <div id="app">
      <!--为echarts准备一个具备大小的容器dom-->
      <div id="main" style="width: 1000px; height: 300px"></div>
    </div>
  </template>
  <script>
  import echarts from "echarts";
//   import {listFundsSelective} from "@/api/funds";
  export default {
    name: "tongJiTu",
    data() {
      return {
        charts: "",
        opinionData: [],
        isWatch: false
     };
    },
    props: {
      t1: []
    },
    watch: {
      t1(res){
        this.drawLine("main",res)
      }
    },
    methods: {
      drawLine(id,res) {
        console.log("统计图1接收数据："+res)
        this.opinionData = res
        this.charts = echarts.init(document.getElementById(id));
        this.charts.setOption({
          tooltip: {
            trigger: "axis",
          },
          legend: {
            data: ["12轮基金变化"],
            top:10
          },
          grid: {
            left: "3%",
            right: "4%",
            bottom: "3%",
            containLabel: true,
          },

        //   toolbox: {
        //     feature: {
        //       saveAsImage: {},
        //     },
        //   },
          xAxis: {
            type: "category",
            boundaryGap: false,
            data: ["1", "2", "3", "4","5","6","7","8","9","10","11","12"],
            axisTick:{
                show:false
            }
          },
          yAxis: {
            type: "value",
            axisTick:{
                show:false
            }
          },

          series: [
            {
              name: "12轮基金变化",
              type: "line",
              stack: "总量",
              data: this.opinionData,
            },
          ],
        });
      },
    },
    //调用
    // mounted() {
    //   this.$nextTick(function () {
    //     this.drawLine("main");
    //   });
    // },
  };
  </script>
  <style scoped>
  </style>
